package top.ddltech.algorithm.util;

/**
 * 排序工具
 */
public class SortUtil {

    public static boolean less(Comparable v, Comparable w) {
        return v.compareTo(w) < 0;
    }

    public static void exch(Comparable[] a, int i, int j) {
        Comparable t = a[i];
        a[i] = a[j];
        a[j] = t;
    }

    public static void show(Comparable[] a) {
        // 在单行中打印数组
        for (Comparable elem : a) {
            System.out.print(elem + " ");
        }
        System.out.println();
    }
}
